<template>
	<view class="content">
		<detail-item :options="buldingInfo"></detail-item>
		<view class="cu-bar bg-white margin-top">
			<view class="action"><text class="cuIcon-title text-blue"></text>全部评论</view>
		</view>
		<comment-item :comments="buldingInfo.commentList"></comment-item>
		<view class="flex  padding justify-center bg-white">
			<navigator class="cu-btn round bg-grey center" :url="'/pages/comment/create?id='+buldingInfo.house.id">发表评论</navigator>
		</view>
		
	</view>
</template>

<script>
	import detailItem from './detail-item.vue';
	
	import commentItem from '@/pages/comment/item.vue';
	export default {
		components: {
			detailItem,
			commentItem
		},
		data() {
			return {
					id:0,
				    buldingInfo:{
					}
				}
			},
				onLoad(e) {
					this.id=e.id;
					this.loadDetailInfo();
				},
				onShareAppMessage(){
					return {
					      title: '选楼盘，查佣金，看房价'
					    }
				},
				methods: {
					
					loadDetailInfo(){
						var me=this;
						uni.request({
							url: me.$rootUrl+'/House/Find',
							data: {id:me.id},
							method: 'GET',
							success(res) {	
								if (res.data.success) {
									me.buldingInfo=res.data.data;
									
								} else {
									uni.showModal({
										content: '服务器错误!',
										showCancel: false
									});
								}
							},
							fail() {
								uni.showModal({
									content: me.connectionFailText,
									showCancel: false
								});
							}
						});
					},
					preImage(swiper){
						
					}
				}
			}
	
</script>

<style lang="scss">
	.content{
		
		.cu-list{
			margin-top:4px;
			
			
			.cu-item{
					padding:10px 15px;
					.text-white{
						font-size: 30px;
						background-color:#007AFF;
						color: white;
						border-radius: 40%;
						height: 50px;
						line-height: 50px;
					}
			}
			
		}
		.detail-info{
			margin-top:4px;
			padding:10px 15px;
		}
		.bottom{
				position: fixed;
				bottom:0;
				display: flex;
				flex-direction: row;
				padding: 10px 0;
				width:100%;
				background:white;
				text-align: center;
				border-top:gray 1px solid;
				button{
					font-size: 30upx;
					
					color:white;
					width:40%;	
				}
			} 	
	}
</style>
